import { IParam, IContext, DataServiceBase, IHttpResponse } from '@/core';
import { Auth_infoDTOHelp } from '../dto-help/auth-info-helps';
import { Auth_info } from '../auth-info';
import Auth_infoKeys from '../auth-info-keys';

/**
 * 认证信息服务对象基类
 * 基于template/src/api/{{appEntities}}/data-service/{{appEntities}}-service-base.ts.hbs生成
 *
 * @export
 * @class Auth_info
 * @extends {EntityBaseService}
 */
export class Auth_infoServiceBase extends DataServiceBase<Auth_info> {
	/**
	 * 存储模式
	 *
	 * @type {(0 | 1 | 3 | 4)} 无本地存储 | 仅本地存储 | 本地及远程存储 | DTO无存储
	 * @memberof Auth_infoServiceBase
	 */
	readonly storageMode: number = 0;

	/**
	 * Creates an instance of Auth_infoServiceBase.
	 *
	 * @param {*} [opts={}]
	 * @memberof Auth_infoServiceBase
	 */
	constructor(opts: IParam = {}) {
		super(opts, 'Auth_info');
	}

	/**
	 * 初始化基础数据
	 *
	 * @protected
	 * @memberof Auth_infoServiceBase
	 */
	protected initBasicData() {
		this.systemName = 'uaa';
		this.appName = 'web';
		this.appEntityName = 'auth_info';
		this.appEntityCodeName = 'auth_info';
		this.appEntityCodeNames = 'auth_infos';
		this.appEntityKeyCodeName = 'id';
		this.appEntityTextCodeName = 'display_name';
	}

	/**
	 * 构造实体
	 *
	 * @protected
	 * @param {IParam} data
	 * @param {IContext} [context]
	 * @return {*} { Auth_info }
	 * @memberof Auth_infoServiceBase
	 */
	protected newEntity(data: IParam, context: IContext = {}): Auth_info {
		return new Auth_info(data);
	}

	/**
	 * 过滤当前实体服务，标准接口数据
	 *
	 * @return {*}  {*}
	 * @memberof Auth_infoServiceBase
	 */
	protected filterEntityData(entity: Auth_info): any {
		const data: any = {};
		Auth_infoKeys.forEach((key) => {
			if (entity[key] !== void 0) {
				data[key] = entity[key];
			}
		});
		return data;
	}
}
